﻿using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PrismDialog_IDialogService
{
    public class UCDetailViewModel : IDialogAware
    {
        /// <summary>
        /// 弹出窗口的标题
        /// </summary>
        public string Title => "123";

        /// <summary>
        /// 执行关闭返回
        /// </summary>
        public event Action<IDialogResult> RequestClose;

        /// <summary>
        /// 当前打开的窗口是否允许关闭
        /// </summary>
        /// <returns></returns>
        public bool CanCloseDialog()
        {
            return true;
        }

        /// <summary>
        /// 当弹出窗口关闭时执行的逻辑
        /// </summary>
        public void OnDialogClosed()
        {
            IDialogResult dialogResult = new DialogResult();
            dialogResult.Parameters.Add("aaaa", true);
            //RequestClose?.Invoke(dialogResult);
        }

        /// <summary>
        /// 当弹出窗口打开时执行的逻辑
        /// </summary>
        /// <param name="parameters"></param>
        public void OnDialogOpened(IDialogParameters parameters)
        {
            var arg = parameters.GetValue<string>("id");
        }
    }
}
